// http://www.jxgwy.org/category/41.html	为例
var preurl = "http://www.jxgwy.org/";
var orgurl = "http://www.jxgwy.org/category/41.html";
var indexofstr = "江西公务员考试职位表";
getData(orgurl);

function getData(orgurl) {
    fetch(orgurl).then(res => res.blob()).then(blob => {
        var reader = new FileReader();
        reader.onload = function(e) {
            var responsetxt = reader.result;
            var nexturl = $(responsetxt).find(".main_left .pages>a:contains(下一页)").attr("href");
            if (nexturl.indexOf(indexofstr) == -1) {
                var nexturl = preurl + nexturl;
            }
            $(responsetxt).find(".main_left>.list>li").each(function(k, v) {
                // console.log(k,v);
                var lititle = $(v).find("span>a>span").text();
                // console.log(lititle);
                if (lititle.indexOf(indexofstr) != -1) {
                    var ahref = $(v).find("span>a").attr("href");
                    if (ahref.indexOf(indexofstr) == -1) {
                        var ahref = preurl + ahref;
                    }
                    console.log(lititle, ahref);
                } else {}
            });
            if (orgurl != nexturl) {
                getData(nexturl);
            }
        }
        reader.readAsText(blob, 'GBK')
    })
}
/*分析网页*/
$(".main_left>.list>li").each(function(k, v) {
    // console.log(k,v);
    var lititle = $(v).find("span>a>span").text();
    console.log(lititle);
    if (lititle.indexOf("公务员考试职位") != -1) {
        var ahref = $(v).find("span>a").attr("href");
        console.log(lititle, ahref);
    } else {}
});